import request from '@/utils/request'

export function settingList(query) {
  return request({
    url: `/settings/list`,
    method: 'get',
    params: query
  })
}

export function updateSetting(query) {
  return request({
    url: '/setting/save',
    method: 'put',
    params: query
  })
}

export function fetchAdminList(query) {
  return request({
    url: '/sys/adminList',
    method: 'get',
    params: query
  })
}

// export function fetchAdmin(query) {
//   return request({
//     url: '/admin',
//     method: 'get',
//     params: query
//   })
// }

export function updateAdmin(query) {
  return request({
    url: 'sys/adminUpdate',
    method: 'post',
    params: query
  })
}

export function deleteAdmin(query) {
  return request({
    url: '/sys/adminDel',
    method: 'delete',
    params: query
  })
}

export function addAdmin(query) {
  return request({
    // url: '/admin',
    url: 'sys/adminAdd',
    method: 'post',
    params: query
  })
}

// 账号状态切换
export function changeAdmin(query) {
  return request({
    url: '/sys/adminStatus',
    method: 'put',
    params: query
  })
}

// 角色列表,无分页
export function fetchRoleList(query) {
  return request({
    url: '/sys/roleAllList',
    method: 'get',
    params: query
  })
}
// 角色列表，有分页
export function fetchRole(query) {
  return request({
    url: '/sys/roleList',
    method: 'get',
    params: query
  })
}
// 权限查询
export function menuTree(query) {
  return request({
    url: '/sys/menuTree',
    method: 'get',
    params: query
  })
}
// 角色权限新增
export function addRole(query) {
  return request({
    url: 'sys/powerAdd',
    method: 'post',
    data: query
  })
}

//角色权限修改
export function updateRole(query) {
  return request({
    url: 'sys/powerSave',
    method: 'post',
    data: query
  })
}
//角色删除

export function deleteRole(query) {
  return request({
    url: 'sys/roleDel',
    method: 'delete',
    params: query
  })
}

// 账号状态切换
export function changeRole(query) {
  return request({
    url: '/sys/roleStatus',
    method: 'put',
    params: query
  })
}
//密码重置
export function resetAdmin(query) {
  return request({
    url: 'sys/resetPwd',
    method: 'post',
    data: query
  })
}
//密码修改
export function updateUserPwd(query) {
  return request({
    url: 'sys/updatePwd',
    method: 'post',
    data: query
  })
}
//日志查看
export function logList(query) {
  return request({
    url: '/sys/log',
    method: 'get',
    params: query
  })
}

// export function fetchBtn() {
//   return request({
//     url: '/amazeBtn',
//     method: 'get'
//   })
// }

// export function editBtn(data) {
//   return request({
//     url: '/amazeBtnEdit',
//     method: 'post',
//     data
//   })
// }
